package impls

import (
	"fmt"

	"gitee.com/knowgo/gpa/engine/constants"
	"gitee.com/knowgo/gpa/engine/sql/dialects/dialect"
)

type baseDriver struct {
	// Dialect       intf.Dialect
	fnMakeDialect func() dialect.Dialect
}

func (b *baseDriver) GetDialect() dialect.Dialect {
	return b.fnMakeDialect()
}

func (b *baseDriver) uri(dial constants.DIALECT) (*dialect.URI, error) {
	dbt := dial.GetDRIVER()
	if dbt == constants.DB_UNKNOWN {
		return nil, fmt.Errorf("no db type surport od dialcet %s", dial)
	}
	return &dialect.URI{DRIVER: dbt}, nil
}
